/* eslint-disable max-statements */ import type { ParsedUrlQuery } from 'querystring'; import type { GetStaticPaths, GetStaticProps } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; import Script from 'next/script'; import { useIntl } from 'react-intl'; import { getLayout, Heading, LinksWidget, type MetaItemData, PageLayout, PostsList, Time, } from '../../components'; import { getAllThematicsSlugs, getThematicBySlug, getThematicsPreview, getTotalThematics, } from '../../services/graphql'; import styles from '../../styles/pages/blog.module.scss'; import type { NextPageWithLayout, PageLink, Thematic } from '../../types'; import { ROUTES } from '../../utils/constants'; import { getLinksItemData, getPageLinkFromRawData, getPostsWithUrl, getSchemaJson, getSinglePageSchema, getWebPageSchema, } from '../../utils/helpers'; import { loadTranslation, type Messages } from '../../utils/helpers/server'; import { useBreadcrumb, useSettings } from '../../utils/hooks'; export type ThematicPageProps = { currentThematic: Thematic; thematics: PageLink[]; translation: Messages; }; const ThematicPage: NextPageWithLayout = ({ currentThematic, thematics, }) => { const { content, intro, meta, slug, title } = currentThematic; const { articles, dates, seo, topics } = meta; const intl = useIntl(); const { items: breadcrumbItems, schema: breadcrumbSchema } = useBreadcrumb({ title, url: `${ROUTES.THEMATICS.INDEX}/${slug}`, }); const headerMeta: (MetaItemData | undefined)[] = [ { id: 'publication-date', label: intl.formatMessage({ defaultMessage: 'Published on:', description: 'ThematicPage: publication date label', id: 'UTGhUU', }), value: